In this section we want to describe the first steps that will make the user in his first contact with the EANPOS device. Provides a simple example that uses the EANPOS device to implement an analog positioner.
We can divide in the following sections, the proceed of the operation:
As was already explained in the description of the EANPOS device, you must program properly the unit application configuration. It is very important to the piece of code that declares the device, Here you should indicate the hardware resources to be used to ensure proper operation. It will be the responsibility of the programmer to pick and choose the most appropriate inputs and outputs. For example with the following line of code:
;--------------------------------- ; Internal device declaration ;--------------------------------- INTDEVICE AxisX EANPOS 2 2.CNT02 3 3.INP01 3.AN01
You define an EANPOS device with “AxisX” name where the sampling time is 2 ms. Have been declared the following hardware resources: the input to the bidirectional meter has address 2.CNT02 (where 2 indicates the slot the card is installed while CNT02 is the mnemonic name of the input), the number of digital input for interruption devoted to zero-pulse bidirectional counter (number 3), a digital input for capturing zero pulse (3.INP01) and the address of the analog output 3.AN01 that regulating the output voltage to manage a drive.
An application that has just inside the device Declaration in configuration unit and a qcl unit that it does not execute anything (unless forced to WAIT) already allows to execute the first operations using the capabilities of the device. After you have transferred the application in the system and having put in RUN, It can change the parameters, observe the States or give commands to devices using the appropriate monitor from QView.
This is very convenient in the early stages of planning when you just want to make some runs or debugging of an application.
After declaring hardware resources properly to use you need to set some parameters as components that are connected to the Qmove product.
Let us consider the case where the bi-directional meter is a digital encoder. Suppose that this is directly keyed on an engine that is to move an axis. You will need to set the parameters correctly measure and pulse of the EANPOS device so that the latter can interpret the pulses of the meter and calculate the position of the axis.
The introduction of measure and pulse lets you match between a space in a unit of your choice and a certain number of pulses. In the event that the user already knows the space covered in a round encoder then you'll proceed directly to projecting values.
Let's clarify this concept with an example: if the encoder emits 1000 pulses/Rev and you know that the axis moves about 5 cm when the encoder performs exactly one revolution then you can enter the following values:
AxisX:measure = 50; AxisX:pulse = 4000
The measure value introduced involves choosing a unit of measure of mm for measuring positions, in the pulse parameter introduces a value equal to the number of encoder impulses multiplied by 4. Remember that the relationship measure/pulse must be a value between 0.00935 to 1 (for precision limits of the device). It is important to emphasize that the values described above are taken as reference: It is not necessary to introduce the parameters with reference to an encoder revolution as we will describe below.
When the user does not know in advance the measurement parameters, will still be able to make the correct calibration by following these steps:
The encoder resolution is now correctly set.
Another important step to take is to set the maxpos and minpos parameters that define respectively the maximum and the minimum position accessible from axis.
The unit of measurement of the instantaneous speed of the axis it was chosen by using unitvel and decpt parameters. You can select the unit of time of speed with the unitvel parameter: if this is to 0 then the speed is measured in Um/min, if it is to 1 then the speed is measured in Um/s. The decpt parameter instead determines whether speed-measuring in multiples of the fundamental units Um. For example, if fundamental measurement units Um=mm, and unitvel=1 you get the speed indicator in the vel variable in:
mm/s (con decpt = 0),
cm/s (con decpt = 1),
dm/s (con decpt = 2),
m/s (con decpt = 3).
Afterwards, if necessary, you need to set the proper display on the terminal operator to adjust the correct decimal point position.
![]() | Attention: before actual placement you must make sure that wiring and mechanical parts are not cause malfunctions. |
|---|
We review the case where the EANPOS device you're using an analog output that is implemented with a DAC device: this will assume 16 bit resolution input discrete values (so between -32768 to 32767) to give analog voltage output range ±10V. This calibration function with analog output can be driven with a constant value in order to test links and functionality.
This section describes the operations to be carried out to verify the correctness of the connections and the functionality of the system which was built.
The EANPOS device generates the voltage value of the analogue output on the basis of a ratio between the maximum speed of the axis and the maximum output voltage. To do this you must set the maxvel parameter, that is the speed at which it moves the axle when you are given maximum voltage to the drive. Obviously the axle must behave symmetrical analog voltage to zero, Therefore the speed must be the same (in module) to the maximum positive or negative voltage.
In order to know the maximum speed there are two ways: the “theoretical method” assumes to know the maximum speed set in drive from which one can easily derive the linear speed.
If you are not aware of the official maximum speed of the motor you must do this:
Now you can then enter the value of the maximum speed in themaxvel parameter.
![]() | Attention: before moving the axis, verify proper operation of emergency and protection devices. |
|---|
The procedures described here have allowed us to complete the first phase of parameterizing device. Now you can run smooth movement of the axis. For example, follow these steps:
This first movement was done without turning the ring by reaction of space, so any error introduced by the values of offset voltage or from external influences is not correct.
Until now it was explained how to do the first placements with the ring of open space, let us now see how to make a first calibration of the PID parameters.
Follow this steps:
When the programmer intends to regulate precisely the parameters of PID controller, he can use a device inside (residing on the QMove) that allows you to record data of the type: primary pulse position, virtual axis positions, analog outputs, following errors, inputs and outputs states. This tool is called RECDATA and uses system CPU RAM of QMove. When used, the memory usage of the data must not exceed 50% of total disability.
Since the effects of PID control produce events very difficult to appreciate with the naked eye, the RECDATA device becomes very useful when you want to adjust pgain, integt or derivt parameters. In fact phenomena such as overshoot or slow due to an excessive value of the integral time must be taken into account during parameterization.
The us of the RECDATA device is very simple, It is sufficient that it is correctly declared in the unit of configuration with a type line:
;--------------------------------- ; Internal device declaration ;--------------------------------- INTDEVICE Recorder RECDATA TCamp QCTL1 QCTL2 IOutA1 IOutA2 IntL1 IntL2 Ing1 Ing2 Out1 Out2
The device is particularly suitable to monitor the settings of a EANPOS device, can then view: position values in impulses (taking data directly from bi-directional counter), theoretical position values that the calculated speed profile generator, the values of an analog output. The user can then easily see whether the parameters you have entered are correct for your needs.
The RECDATA device can record information about two axes, for our purpose we can only declare relative addresses to the first axis leaving to X.X the other.
A more detailed description of the RECDATA device it can be found in section, here we simply list the steps to use it:
![]() | Note: the RECDATA device registers a significant amount of data within the product QMove RAM, at the time of acquisition by the pc the transfer takes place via serial. This operation can be very long because of the low speed of serial comunication. The user then can adopt some measures as: * The user then can adopt some precautions pay attention to record only the variables that need to be monitored * increase the sampling time of the RECDATA device |
|---|
Nella sezione precedente è stato spiegato quali sono i primi passi da seguire per una procedura di movimentazione di un asse con un posizionatore analogico. Tale esempio impiega solo un ristretto spettro dei parametri impostabili del device, in questa sezione inseriamo un codice di esempio, dettagliatamente commentato, da cui l'utilizzatore può prendere spunto per sviluppare un applicativo. Il modo in cui il device va dichiarato è spiegato precedentemente, e perciò in questa sezione è omessa la unit di configurazione.Vedi qui
Questo applicativo utilizza 4 ingressi: 1 per avanti manuale, 1 per indietro manuale, 1 per comando di start ed 1 per comando di stop. Saranno disponibili la modalità di funzionamento manuale ed automatica: in manuale è possibile utilizzare i comandi di jog mentre in automatico è possibile far effettuare un posizionamento alla posizione ed alla velocità desiderata:
;*************************************************************************************
; Unit di configurazione (sono riportate solo le dichiarazioni di variabili e
; sono omesse le dichiarazioni del bus e del device)
;*************************************************************************************
;-------------------------------------------------------------------------------------
; Definizione Variabili SYSTEM
;-------------------------------------------------------------------------------------
SYSTEM
slQuotaPos L ;Variabile per quota di posizionamento
slVelAsse L ;Variabile per velocità asse
;-------------------------------------------------------------------------------------
; Definizione Variabili GLOBAL
;-------------------------------------------------------------------------------------
GLOBAL
gfMovMan F ;Flag segnalazione movimenti manuali in corso
gfMovAuto F ;Flag segnalazione movimenti automatici in corso
;-------------------------------------------------------------------------------------
; Definizione Variabili INPUT
;-------------------------------------------------------------------------------------
INPUT
ifAvMan F 2.INP01 ;Ingresso di avanti manuale
ifInMan F 2.INP02 ;Ingresso di indietro manuale
ifStart F 2.INP03 ;Ingresso di START asse
ifStop F 2.INP04 ;Ingresso di STOP asse
;-------------------------------------------------------------------------------------
; Definizione Variabili OUTPUT
;-------------------------------------------------------------------------------------
OUTPUT
ofToll F 2.OUT01 ;Uscita di asse in tolleranza
ofAxeFermo F 2.OUT02 ;Uscita di asse fermo
;*************************************************************************************
; Unit qcl
;*************************************************************************************
;-------------------------------------------------------------------------------------
; Operazioni di parametrizzazione del device
;-------------------------------------------------------------------------------------
Asse:measure = 10000
Asse:pulse = 40000 ;come calcolare measure e pulse è spiegato nel paragrafo apposito.*
Asse:maxvel = 100000 ;come calcolare maxvel è spiegato nel paragrafo apposito.*
Asse:maxpos = 999999 ;Quota massima
Asse:minpos = -999999 ;Quota minima
Asse:maxfollerr = 10000 ;Errore di inseguimento massimo
Asse:unitvel = 0 ;Unità di tempo della velocità (velocità in Um/min)
Asse:decpt = 0 ;Cifre decimali nel calcolo della velocità
Asse:rampmode = 0 ;Tipo di rampe utilizzate (in questo caso stesso tempo di accelerazione
;o decelerazione da velocità zero a velocità massima)
Asse:taccdec = 100 ;Tempo di accelerazione e di decelerazione
Asse:pgain = 10 ;Guadagno proporzionale
Asse:feedfw = 1000 ;Feedforward
INIT Asse ;Inizializza il device
WAIT Asse:st_init ;Attendi che il device sia inizializzato
CNTUNLOCK Asse ;Sblocca acquisizione posizione
WAIT NOT Asse:st_cntlock ;Attendi che l'acquisizione della posizione sia sbloccato
CNTDIR Asse ;Imposta il senso dell'acquisizione di posizione
WAIT NOT Asse:st_cntrev ;Attendi che sia impostato il senso dell'acquisizione di posizione
REGON Asse ;Abilita la regolazione
WAIT NOT Asse:st_regoff ;Attendi l'abilitazione alla regolazione
RESUME Asse ;Togli l'asse dallo stato di emergenza
WAIT NOT Asse:st_emrg ;Attendi che l'asse non sia in emergenza
LOOPON Asse ;Aggancia loop di reazione dell'asse
WAIT Asse:st_loopon ;Attendi che sia agganciato il loop di reazione dell'asse
IF (slVelAsse EQ 0) ;Nel caso in cui il set di velocità dell'asse sia zero
slVelAsse = 50 ;Imposta una velocità di posizionamento
ENDIF
IF (slQuotaPos EQ 0) ;Nel caso in cui la quota di posizionamento dell'asse sia zero
slQuotaPos = 2000 ;Imposta una quota di posizionamento
ENDIF
;-------------------------------------------------------------------------------------
; Operazioni di Posizionamento
;-------------------------------------------------------------------------------------
; ------------------------------- variabili utilizzate ------------------------------
; slVelAsse: Variabile impostabile che rappresenta la velocità dell'asse (espressa in % della vel.max.)
; slQuotaPos: Variabile impostabile che rappresenta la quota di posizionamento dell'asse
; ---------------------------------- flag utilizzati --------------------------------
; gfMovMan: Movimento manuale in corso
; gfMovAuto: Movimento automatico in corso
;-------------------------------------------------------------------------------------
MAIN:
;-------------------------------------------------------------------------------------
; Gestione uscite
;-------------------------------------------------------------------------------------
ofToll = Asse:st_toll ;Imposto l'uscita di tolleranza come lo stato di tolleranza
ofAxeFermo = Asse:st_still ;Imposto l'uscita di asse fermo come lo stato di asse fermo
;-------------------------------------------------------------------------------------
; Gestione movimenti automatici
;-------------------------------------------------------------------------------------
IF ifStart ;Attende l'ingresso di START
IF NOT gfMovMan ;Controlla che non ci siano movimenti manuali
IF Asse:st_still ;Controlla che l'asse sia fermo
Asse:setvel=(slVelAsse*Asse:maxvel)/100 ;Imposta la velocità dell'asse
Asse:setpos = slQuotaPos ;Imposta la quota di posizionamento
START Asse ;Esegue lo start dell'asse
gfMovAuto = 1 ;Segnala movimento automatico in corso
ENDIF
ENDIF
ENDIF
IF ifStop ;Attende l'ingresso di STOP
IF NOT Asse:st_still ;Controlla che l'asse NON sia fermo
STOP Asse ;Esegue lo stop dell'asse
ENDIF
ENDIF
IF gfMovAuto ;Controlla segnalazione movimento automatico in corso
IF Asse:st_still ;Controlla che l'asse sia fermo
gfMovAuto = 0 ;Resetta stato di movimento Automatico
ENDIF
ENDIF
;-------------------------------------------------------------------------------------
; Gestione movimenti manuali (JOG)
;-------------------------------------------------------------------------------------
IF ifAvMan ;Attende l'ingresso di movimento manuale
IF NOT (gfMovAuto OR gfMovMan) ;Controlla che non ci siano movimenti automatici o manuali in corso
IF Asse:st_still ;Controlla che l'asse sia fermo
Asse:setvel=(slVelAsse*Asse:maxvel)/100 ;Imposta la velocità dell'asse (percentuale della velocità massima)
MANFW Asse ;Avanti asse in manuale
gfMovMan = 1 ;Segnala movimento manuale in corso
ENDIF
ENDIF
ENDIF
IF ifInMan ;Attende l'ingresso di movimento manuale
IF NOT (gfMovAuto OR gfMovMan) ;Controlla che non ci siano movimenti automatici o manuali in corso
IF Asse:st_still ;Controlla che l'asse sia fermo
Asse:setvel=(slVelAsse*Asse:maxvel)/100 ;Imposta la velocità dell'asse
MANBW Asse ;Avanti asse in manuale
gfMovMan = 1 ;Segnala movimento manuale in corso
ENDIF
ENDIF
ENDIF
IF gfMovMan ;Se l'asse si muove in manuale
IF NOT (ifAvMan OR ifInMan) ;Se gli ingressi di avanti e indietro manuale sono OFF
STOP Asse ;Ferma l'asse
gfMovMan = 0 ;Togli la segnalazione di asse in movimento manuale
ENDIF
ENDIF
;-------------------------------------------------------------------------------------
; Operazioni finali
;-------------------------------------------------------------------------------------
WAIT 1
JUMP MAIN
END
*come calcolare measure e pulse è spiegato nel paragrafo apposito.